package com.bestcem.xm.user.controller;

import com.alibaba.fastjson.JSON;
import com.bestcem.xm.common.core.domain.web.XmResultJson;
import com.bestcem.xm.om.dao.mapper.OmUserPackMapper;
import com.bestcem.xm.user.util.business.UserPermissionUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping(value = "/test")
public class TestController {

    @Resource
    private UserPermissionUtil permissionUtil;

    /**
     * 编辑层级
     *
     * @return
     */
    @PutMapping("/test")
    public XmResultJson<String> test() {
        String value = JSON.toJSONString(permissionUtil.getAllPermission());
        return XmResultJson.success(value);
    }

    @Autowired
    private OmUserPackMapper omUserPackMapper;

    @GetMapping("/getById")
    public void getById() {
        omUserPackMapper.queryById("64be710816f6d778dd5b16e2");
    }
}
